package com.zl.smartmall.library.po;

import java.util.ArrayList;
import java.util.List;

import net.tsz.afinal.annotation.sqlite.Id;
import net.tsz.afinal.annotation.sqlite.Property;
import net.tsz.afinal.annotation.sqlite.Table;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * 商城活动(首)页品牌图标
 * 
 * @author 陈希然
 * 
 */
@Table(name = "tb_ActivitiesClassifyIcon")
public class ActivitiesBrandIconInfo extends BaseActivitiesInfo {

	@Id
	private int id;
	@Property
	private int activitiesId;
	@Property
	private int width;
	@Property
	private int height;
	@Property
	private String intro;
	@Property
	private String name;
	@Property
	private String icon;
	
	private String content;

	private String icontype;
	public String getIcontype() {
		return icontype;
	}

	public void setIcontype(String icontype) {
		this.icontype = icontype;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getActivitiesId() {
		return activitiesId;
	}

	public void setActivitiesId(int activitiesId) {
		this.activitiesId = activitiesId;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public String getIntro() {
		return intro;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public static List<ActivitiesBrandIconInfo> parse(JSONArray jsonArray, int activitiesInfoType) throws JSONException {
		List<ActivitiesBrandIconInfo> activitiesClassifyIcons = new ArrayList<ActivitiesBrandIconInfo>();
		
		for(int i = 0; jsonArray != null && i < jsonArray.length(); i++) {
			JSONObject jsonObject = jsonArray.getJSONObject(i);
			ActivitiesBrandIconInfo activitiesClassifyIcon = new ActivitiesBrandIconInfo();
			activitiesClassifyIcon.activitiesId = jsonObject.getInt("act_id");
			activitiesClassifyIcon.height = jsonObject.getInt("height");
			activitiesClassifyIcon.icon = jsonObject.getString("pic");
			activitiesClassifyIcon.intro = jsonObject.getString("intro");
			activitiesClassifyIcon.name = jsonObject.getString("name");
			activitiesClassifyIcon.width = jsonObject.getInt("width");
			activitiesClassifyIcon.content = jsonObject.optString("content");
			activitiesClassifyIcon.icontype = jsonObject.optString("icon_type");
			activitiesClassifyIcon.activitiesInfoType = activitiesInfoType;
			activitiesClassifyIcons.add(activitiesClassifyIcon);
		}
		
		return activitiesClassifyIcons;
	}
	
}
